package com.sls.sys.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.sls.page.Pagination;
import com.sls.sys.dao.RoleInfoDAO;
import com.sls.sys.pojo.RoleInfo;
import com.sls.sys.querybean.RoleInfoQuery;

@Repository("roleInfoDAO")
public class RoleInfoDAOImpl extends SuperDAO<RoleInfo> implements RoleInfoDAO {

	@Override
	public void insert(RoleInfo roleInfo) {
		getSqlSession().insert("mybatis.xml.RoleInfoMapper.insert", roleInfo);
	}

	@Override
	public void deleteById(String id) {
		getSqlSession().update("mybatis.xml.RoleInfoMapper.deleteById", id);
	}

	@Override
	public void updateById(RoleInfo roleInfo) {

		getSqlSession().update("mybatis.xml.RoleInfoMapper.updateById", roleInfo);
	}

	@Override
	public RoleInfo findById(String id) {
		return getSqlSession().selectOne("mybatis.xml.RoleInfoMapper.findById", id);
	}

	@Override
	public Pagination<RoleInfo> queryPage(RoleInfoQuery query) {
		query.calculate();
		return super.queryPagination("mybatis.xml.RoleInfoMapper.queryRolePage",
				"mybatis.xml.RoleInfoMapper.queryRoleNumber", query);
	}

	@Override
	public List<RoleInfo> queryAll() {
		List<RoleInfo> list = getSqlSession().selectList(
				"mybatis.xml.RoleInfoMapper.queryAll");
		return list;
	}

}
